<template>
	<view class="reduce-box">
		<view class="items-center">
			<view class="fcc btn-num reduce" style="border-color: #d2d1cf;" @click="increase('-')" v-if="qty>0">
				<u-icon name="minus" bold color="#d2d1cf" size="13"></u-icon>
			</view>
			<view class="num" v-if="qty">{{ qty }}</view>
			<view class="fcc btn-num increase" @click="increase('+')">
				<u-icon name="plus" bold color="white" size="13"></u-icon>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getaddress,
	} from '@/api/all.js';
	export default {
		props: {
			qty: {
				type: Number,
				default: 0
			},
			item: {
				type: Object,
				default: {}
			},
			index: {
				type: Number,
				default: 0
			},
			shopid: {
				type: Number,
				default: 0
			},

		},
		data() {
			return {
				numValue: 0,
			}
		},
		methods: {
			increase(symbol) {
				this.$store.commit('setTotalprice', {
					symbol: symbol,
					item: this.item,
					index: this.index,
					shopid: this.shopid
				})
			},
			//获取地址
			getAddress() {
				this.loadshow = true;
				getaddress({}).then((res) => {
					if (res.code == 200) {
						let data = res.body.data;
						this.$store.commit('setUseraddress', data);
					}
				})
			},

		},
	}
</script>

<style lang="scss" scoped>
	.items-center {
		display: flex;
		align-items: center;
		justify-content: center;

		.btn-num {
			width: 38rpx;
			height: 38rpx;
			border: 1px solid $uni-color-topic;
			border-radius: 50%;
		}

		.reduce {
			color: $uni-color-topic;

			.text {
				width: 24rpx;
				height: 4rpx;
				background: $uni-color-topic;
			}
		}

		.reduce {
			color: $uni-color-topic;

			.text {
				width: 24rpx;
				height: 4rpx;
				background: $uni-color-topic;
			}
		}

		.fcc {
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.increase {
			color: white;
			background: $uni-color-topic;
			font-weight: bold;
		}

		.btn-num {

			font-weight: bold;

		}

		.num {
			width: 60rpx;
			text-align: center;
			padding-top: 5rpx;
			box-sizing: border-box;
		}
	}
</style>